#pragma once

#include <chrono>
#include <ratio>
#include "utils.hpp"

namespace qbe::ecs {
class Time {
 private:
  std::chrono::time_point<std::chrono::high_resolution_clock> _first_update;
  std::chrono::time_point<std::chrono::high_resolution_clock> _last_update;
  std::chrono::duration<double, std::ratio<1>> _last_update_delta;

  std::chrono::high_resolution_clock::time_point start_time;
  bool is_running = false;

 public:
  Time() {};
  ~Time() {};

  std::chrono::duration<double, std::ratio<1>> startup();

  void update_with_instant(std::chrono::time_point<std::chrono::high_resolution_clock>&& instant);

  std::chrono::duration<double, std::ratio<1>> delta();

  double delta_seconds();

  void Start();
  double TotalTime() const;
  double End();
};

}  // namespace qbe::ecs